package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
@Setter@Getter@ToString
@JsonIgnoreProperties(value = {"handler","hibernateLazyInitializer","fieldHandler"})
public class Travel extends BaseDomain{
public static final int STATE_REJECT=0;//拒绝
public static final int STATE_NORMAL=1;//草稿
public static final int STATE_REVIEW=2;//审核中
public static final int STATE_PASS=3;//审核通过

    private String title;//标题

    @JsonFormat(pattern ="yyyy-MM-dd" , timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date travelTime;//旅游时间

    private String perExpends;//人均消费

    private Integer days;//旅游天数

    private Integer person;//跟谁一起去

    private User author;//作者

    @JsonFormat(pattern ="yyyy-MM-dd" , timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;//写的时间
    @JsonFormat(pattern ="yyyy-MM-dd" , timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date releaseTime;//发布时间

    private Boolean isPublic;//是否公开

    private Region place;//地点

    private String coverUrl;//主页图片
    @JsonFormat(pattern ="yyyy-MM-dd" , timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date lastUpdateTime;//最后更新时间

    private int state;//状态

    private TravelContent travelContent;//内容

    public String getStateName(){
        String stateName="失败";
        if (state==STATE_REVIEW){
                stateName="待审核";
        }else if (state==STATE_NORMAL){
            stateName="草稿状态";
        }else if (state==STATE_PASS){
            stateName="已发布";
        }
        return stateName;
    }

}